{
	template:`
    <m-page @back="back" title="用户登录">
        <m-top></m-top>
        <m-title>登录</m-title>
        <m-card>
            <div class="cu-form-group">
                <div class="title text-red">手机号</div>
                <m-input v-model="login.phoneNum" placeholder="请输入手机号"></m-input>
            </div>
            <div class="cu-form-group">
                <div class="title text-red">密码</div>
                <m-input v-model="login.password" placeholder="请输入密码"></m-input>
            </div>
            <div class="cu-form-group">
                <div class="flex-sub text-right padding-right">一周内自动登录</div>
                <m-switch v-model="autoLogin"></m-switch>
            </div>
        </m-card>
        <div class="flex padding-lr padding-bottom">
            <div class="flex-sub flex flex-direction">
                <m-button @click="userLogin">登录</m-button>
            </div>
        </div>
		<m-title>获取员工账号</m-title>
		<m-alert light color="blue">联系商家管理员，创建员工账号即可登录。</m-alert>
		<m-title>申请新商家账号</m-title>
		<m-alert light color="green">
            申请新商家，数据独立，可添加新的员工一起使用。
            <span class="text-blue" @click="toApplyBusiness">点击立即申请</span>
		</m-alert>
    </m-page>
	`,
	props: ['param','parentVue'],
	data:function(){
		return {
            login:{},
            autoLogin:'Y'
		};
	},
	mounted(){
	},
	methods:{
        userLogin:function(){
            this.requestData('action/base/userInfo/login',
                {model:this.login},
                (data)=>{
                    if(data.code==0){
                        this.remind().success(data.msg);
                        if(this.autoLogin=='Y'){
                            document.cookie="user_token="+data.user.token+"; expires="+new Date(new Date().getTime()+7*24*60*60*1000).toGMTString();
                        }
                        this.back(true);
                    }else{
                        this.remind().error(data.msg);
                    }
                }
            );
        },
        toApplyBusiness:function(){
	        this.openPage('base/applyBusiness.js',{},(flag)=>{
	        });
        }
	}
}